home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Devpac 2.12 disk 2.adf / include.cbm / libraries / dosextens.i < prev    next >
Text File  |  1987-03-31  |  9KB  |  233 lines

  1.  
  2. * DOS structures not needed for the casual DOS user
  3.  
  4.    IFND  LIBRARIES_DOSEXTENS_I
  5.  
  6. LIBRARIES_DOSEXTENS_I   SET   1
  7.  
  8.      IFND  EXEC_TYPES_I
  9.      INCLUDE "exec/types.i"
  10.      ENDC
  11.      IFND  EXEC_TASKS_I
  12.      INCLUDE "exec/tasks.i"
  13.      ENDC
  14.      IFND  EXEC_PORTS_I
  15.      INCLUDE "exec/ports.i"
  16.      ENDC
  17.      IFND  EXEC_LIBRARIES_I
  18.      INCLUDE "exec/libraries.i"
  19.      ENDC
  20.  
  21.      IFND  LIBRARIES_DOS_I
  22.      INCLUDE "libraries/dos.i"
  23.      ENDC
  24.  
  25.  
  26. * All DOS processes have this STRUCTure
  27. * Create and DeviceProc returns pointer to the MsgPort in this STRUCTure
  28. * Process_addr = DeviceProc(..) - TC_SIZE
  29.  
  30.  STRUCTURE Process,0
  31.     STRUCT  pr_Task,TC_SIZE
  32.     STRUCT  pr_MsgPort,MP_SIZE  * This is BPTR address from DOS functions
  33.     WORD    pr_Pad              * Remaining variables on 4 byte boundaries
  34.     BPTR    pr_SegList          * Array of seg lists used by this process
  35.     LONG    pr_StackSize        * Size of process stack in bytes
  36.     APTR    pr_GlobVec          * Global vector for this process (BCPL)
  37.     LONG    pr_TaskNum          * CLI task number of zero if not a CLI
  38.     BPTR    pr_StackBase        * Ptr to high memory end of process stack
  39.     LONG    pr_Result2          * Value of secondary result from last call
  40.     BPTR    pr_CurrentDir       * Lock associated with current directory
  41.     BPTR    pr_CIS              * Current CLI Input Stream
  42.     BPTR    pr_COS              * Current CLI Output Stream
  43.     APTR    pr_ConsoleTask      * Console handler process for current window
  44.     APTR    pr_FileSystemTask   * File handler process for current drive
  45.     BPTR    pr_CLI              * pointer to ConsoleLineInterpreter
  46.     APTR    pr_ReturnAddr       * pointer to previous stack frame
  47.     APTR    pr_PktWait          * Function to be called when awaiting msg
  48.     APTR    pr_WindowPtr        * Window pointer for errors
  49.     LABEL   pr_SIZEOF           * Process
  50.  
  51. * The long word address (BPTR) of this STRUCTure is returned by
  52. * Open() and other routines that return a file.  You need only worry
  53. * about this STRUCT to do async io's via PutMsg() instead of
  54. * standard file system calls
  55.  
  56.  STRUCTURE FileHandle,0
  57.    APTR   fh_Link               * pointer to EXEC message
  58.    APTR   fh_Interactive        * Boolean; TRUE if interactive handle
  59.    APTR   fh_Type               * Port to do PutMsg() to
  60.    LONG   fh_Buf
  61.    LONG   fh_Pos
  62.    LONG   fh_End
  63.    LONG   fh_Funcs
  64. fh_Func1 EQU fh_Funcs
  65.    LONG   fh_Func2
  66.    LONG   fh_Func3
  67.    LONG   fh_Args
  68. fh_Arg1 EQU fh_Args
  69.    LONG   fh_Arg2
  70.    LABEL  fh_SIZEOF * FileHandle
  71.  
  72. * This is the extension to EXEC Messages used by DOS
  73.  STRUCTURE DosPacket,0
  74.    APTR   dp_Link         * pointer to EXEC message
  75.    APTR   dp_Port         * pointer to Reply port for the packet
  76. *                         * Must be filled in each send.
  77.    LONG   dp_Type         * See ACTION_... below and
  78. *                         * 'R' means Read, 'W' means Write to the file system
  79.    LONG   dp_Res1         * For file system calls this is the result
  80. *                         * that would have been returned by the
  81. *                         * function, e.g. Write ('W') returns actual
  82. *                         * length written
  83.    LONG   dp_Res2         * For file system calls this is what would
  84. *                         * have been returned by IoErr()
  85.    LONG   dp_Arg1
  86. *  Device packets common equivalents
  87. dp_Action  EQU  dp_Type
  88. dp_Status  EQU  dp_Res1
  89. dp_Status2 EQU  dp_Res2
  90. dp_BufAddr EQU  dp_Arg1
  91.    LONG   dp_Arg2
  92.    LONG   dp_Arg3
  93.    LONG   dp_Arg4
  94.    LONG   dp_Arg5
  95.    LONG   dp_Arg6
  96.    LONG   dp_Arg7
  97.    LABEL  dp_SIZEOF * DosPacket
  98.  
  99. * A Packet does not require the Message to before it in memory, but
  100. * for convenience it is useful to associate the two.
  101. * Also see the function init_std_pkt for initializing this STRUCTure
  102.  
  103.  STRUCTURE StandardPacket,0
  104.    STRUCT sp_Msg,MN_SIZE
  105.    STRUCT sp_Pkt,dp_SIZEOF
  106.    LABEL  sp_SIZEOF * StandardPacket
  107.  
  108.  
  109. * Packet types
  110. ACTION_NIL              EQU     0
  111. ACTION_GET_BLOCK        EQU     2
  112. ACTION_SET_MAP          EQU     4
  113. ACTION_DIE              EQU     5
  114. ACTION_EVENT            EQU     6
  115. ACTION_CURRENT_VOLUME   EQU     7
  116. ACTION_LOCATE_OBJECT    EQU     8
  117. ACTION_RENAME_DISK      EQU     9
  118. ACTION_WRITE            EQU     'W'
  119. ACTION_READ             EQU     'R'
  120. ACTION_FREE_LOCK        EQU     15
  121. ACTION_DELETE_OBJECT    EQU     16
  122. ACTION_RENAME_OBJECT    EQU     17
  123.  
  124. ACTION_COPY_DIR         EQU     19
  125. ACTION_WAIT_CHAR        EQU     20
  126. ACTION_SET_PROTECT      EQU     21
  127. ACTION_CREATE_DIR       EQU     22
  128. ACTION_EXAMINE_OBJECT   EQU     23
  129. ACTION_EXAMINE_NEXT     EQU     24
  130. ACTION_DISK_INFO        EQU     25
  131. ACTION_INFO             EQU     26
  132.  
  133. ACTION_SET_COMMENT      EQU     28
  134. ACTION_PARENT           EQU     29
  135. ACTION_TIMER            EQU     30
  136. ACTION_INHIBIT          EQU     31
  137. ACTION_DISK_TYPE        EQU     32
  138. ACTION_DISK_CHANGE      EQU     33
  139.  
  140.  
  141. * DOS library node structure.
  142. * This is the data at positive offsets from the library node.
  143. * Negative offsets from the node is the jump table to DOS functions
  144. * node = (STRUCT DosLibrary *) OpenLibrary( "dos.library" .. )
  145.  
  146.  STRUCTURE DosLibrary,0
  147.     STRUCT  dl_lib,LIB_SIZE
  148.     APTR    dl_Root          * Pointer to RootNode, described below
  149.     APTR    dl_GV            * Pointer to BCPL global vector
  150.     LONG    dl_A2            * Private register dump of DOS
  151.     LONG    dl_A5
  152.     LONG    dl_A6
  153.     LABEL   dl_SIZEOF *  DosLibrary
  154.  
  155. *
  156.  
  157.  STRUCTURE RootNode,0
  158.     BPTR    rn_TaskArray       * [0] is max number of CLI's
  159. *                              * [1] is APTR to process id of CLI 1
  160. *                              * [n] is APTR to process id of CLI n
  161.     BPTR    rn_ConsoleSegment  * SegList for the CLI
  162.     STRUCT  rn_Time,ds_SIZEOF  * Current time
  163.     LONG    rn_RestartSeg      * SegList for the disk validator process
  164.     BPTR    rn_Info            * Pointer ot the Info structure
  165.     BPTR    rn_FileHandlerSegment * code for file handler 
  166.     LABEL   rn_SIZEOF * RootNode
  167.  
  168.  STRUCTURE DosInfo,0
  169.     BPTR    di_McName          * Network name of this machine currently 0
  170.     BPTR    di_DevInfo         * Device List
  171.     BPTR    di_Devices         * Currently zero
  172.     BPTR    di_Handlers        * Currently zero
  173.     APTR    di_NetHand         * Network handler processid currently zero
  174.     LABEL   di_SIZEOF * DosInfo
  175.  
  176. * DOS Processes started from the CLI via RUN or NEWCLI have this additional
  177. * set to data associated with them
  178.  
  179.  STRUCTURE CommandLineInterface,0
  180.     LONG   cli_Result2         * Value of IoErr from last command
  181.     BSTR   cli_SetName         * Name of current directory
  182.     BPTR   cli_CommandDir      * Lock associated with command directory
  183.     LONG   cli_ReturnCode      * Return code from last command
  184.     BSTR   cli_CommandName     * Name of current command
  185.     LONG   cli_FailLevel       * Fail level (set by FAILAT)
  186.     BSTR   cli_Prompt          * Current prompt (set by PROMPT)
  187.     BPTR   cli_StandardInput   * Default (terminal) CLI input
  188.     BPTR   cli_CurrentInput    * Current CLI input
  189.     BSTR   cli_CommandFile     * Name of EXECUTE command file
  190.     LONG   cli_Interactive     * Boolean True if prompts required
  191.     LONG   cli_Background      * Boolean True if CLI created by RUN
  192.     BPTR   cli_CurrentOutput   * Current CLI output
  193.     LONG   cli_DefaultStack    * Stack size to be obtained in long words
  194.     BPTR   cli_StandardOutput  * Default (terminal) CLI output
  195.     BPTR   cli_Module          * SegList of currently loaded command
  196.     LABEL  cli_SIZEOF  * CommandLineInterface
  197.  
  198.  
  199. *
  200. * this structure needs some work.  It should really be a union, because
  201. * it can take on different valued depending on whether it is a device,
  202. * an assigned directory, or a volume.
  203. * For now, it reflects a volume.
  204. *
  205.  STRUCTURE DevList,0
  206.     BPTR        dl_Next                 ; bptr to next device list
  207.     LONG        dl_Type                 ; see DLT below
  208.     APTR        dl_Task                 ; ptr to handler task
  209.     BPTR        dl_Lock                 ; not for volumes
  210.     STRUCT      dl_VolumeDate,ds_SIZEOF ; creation date
  211.     BPTR        dl_LockList             ; outstanding locks
  212.     LONG        dl_DiskType             ; 'DOS', etc
  213.     LONG        dl_unused
  214.     BSTR        dl_Name                 ; bptr to bcpl name
  215.     LABEL       DevList_SIZEOF
  216.  
  217. * definitions for dl_Type
  218. DLT_DEVICE      EQU     0
  219. DLT_DIRECTORY   EQU     1
  220. DLT_VOLUME      EQU     2
  221.  
  222.  
  223. * a lock structure, as returned by Lock() or DupLock()
  224.  STRUCTURE FileLock,0
  225.     BPTR        fl_Link                 ; bcpl pointer to next lock
  226.     LONG        fl_Key                  ; disk block number
  227.     LONG        fl_Access               ; exclusive or shared
  228.     APTR        fl_Task                 ; handler task's port
  229.     BPTR        fl_Volume               ; bptr to a DeviceList
  230.     LABEL       fl_SIZEOF
  231.  
  232.    ENDC  LIBRARIES_DOSEXTENS_I
  233.